﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="_login" %>
<%@ Register src="ascx/header.ascx" tagname="header" tagprefix="uc1" %>
<%@ Register src="ascx/footer.ascx" tagname="footer" tagprefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>网站后台管理中心</title>
    <link rel="stylesheet" type="text/css" href="css/common.css" />
    <link rel="stylesheet" type="text/css" href="css/login.css" />
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript">
        var username_reg = /[a-zA-Z0-9]{1,}/;
        //验证
        function myvalidate() {
            var username = $.trim($("#txt_UserName").val());
            var password = $.trim($("#txt_Password").val());
            var yancode = $.trim($("#txt_YanCode").val());
            
            var message = "";
            if (username == "") {
                message += "- 用户名不能为空\n";
            }
            else if (!username_reg.test(username)) {
                message += "- 用户名必须为A-Z0-9的字符\n";
            }
            if (password == "") {
                message += "- 密码不能为空\n";
            }
            else if (!username_reg.test(password)) {
                message += "- 密码必须为A-Z0-9的字符\n";
            }
            if (yancode == "") {
                message += "- 验证码不能为空\n";
            }
            else if (yancode.length != 4) {
                message += "- 验证码必须是为4位的字符\n";
            }

            if (message != "") {
                alert(message);
                return false;
            }

            return true;
        }
        
        //设置密码
        function writepassword() {
            var username = $.trim($("#txt_UserName").val());
            if (pwd != "" && pwd.split('+')[0] == username) {
                $("#txt_Password").val(pwd.split('+')[1]);
            }
        }

        var chk_login_reg = /login.aspx$/;
        //判断登录地址
        function loadurl() {
            if (window.parent != null && !chk_login_reg.test(window.parent.location.href)) {
                window.parent.location.href = '/web_admin/login.aspx';
            }
        }
        loadurl();
    </script>
</head>
<body>
<form id="form1" runat="server">
<uc1:header ID="header1" runat="server" />
<div class="logBox">
	<div class="logTit"></div>
    <div class="logForm">
    	<div class="iptL name"><asp:TextBox ID="txt_UserName" onblur="writepassword();" runat="server"></asp:TextBox></div>
        <div class="iptL pass"><asp:TextBox ID="txt_Password" TextMode="Password" runat="server"></asp:TextBox></div>
        <div class="iptYc">
        	<div class="iptC"><asp:TextBox ID="txt_YanCode" runat="server"></asp:TextBox></div>
            <My:ValidateCodeImage ID="txt_YanCodeImage" runat="server" />
        </div>
        <div class="btnl">
        	<asp:Button ID="but_login" CssClass="btns" runat="server" Text="登录" OnClientClick="return myvalidate();" onclick="but_login_Click" />
            <input name="" type="reset" value="重置" class="btns" />
            <asp:CheckBox ID="chk_Remember" runat="server" />记住我的密码
        </div>
    </div>
</div>
<uc2:footer ID="footer1" runat="server" />
</form>
<script type="text/javascript">
	var wid = document.documentElement.clientWidth;
	document.getElementById("botBar").style.width=(wid-60)+"px";
	var hei = document.documentElement.clientHeight;
	if(hei<550){
		document.getElementById("botBar").style.position = "static";
		document.getElementById("botBar").style.marginTop = "120px";
		}
</script>
</body>
</html>